# eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog

Module implementing a simple Python syntax checker.

### Global Attributes

None

### Classes

SyntaxCheckerDialog | Class implementing a dialog to display the results of a syntax check run.

### Functions

None

## SyntaxCheckerDialog

Class implementing a dialog to display the results of a syntax check run.

### Derived from

QDialog, Ui_SyntaxCheckerDialog

### Class Attributes

errorRole
filenameRole
indexRole
lineRole
warningRole

### Class Methods

None

### Methods

SyntaxCheckerDialog | Constructor
__batchFinished | Private slot handling the completion of a batch job.
__cancel | Private method to cancel the current check run.
__clearErrors | Private method to clear all error and warning markers of open editors to be checked.
__createErrorItem | Private slot to create a new error item in the result list.
__createFileStatistics | Private method to return the file statistics entry.
__createHeaderItem | Private method to create a header item in the result list.
__createResultItem | Private method to create an entry in the result list.
__defaultStatistics | Private method to return the default statistics entry.
__finish | Private slot called when the syntax check finished or the user pressed the button.
__processError | Private slot to process an error indication from the service.
__processResult | Private slot to display the reported messages.
__resetStatistics | Private method to reset the statistics data.
__resort | Private method to resort the tree.
__updateStatistics | Private method to update the statistics.
__updateStatisticsArea | Private method to update the statistics area of the dialog.
check | Public method to start a check for one file.
checkBatch | Public method to start a style check batch job.
closeEvent | Protected method to handle a close event.
on_buttonBox_clicked | Private slot called by a button of the button box clicked.
on_resultList_itemActivated | Private slot to handle the activation of an item.
on_showButton_clicked | Private slot to handle the "Show" button press.
on_startButton_clicked | Private slot to start a syntax check run.
prepare | Public method to prepare the dialog with a list of filenames.
setArguments | Public method to set additional arguments to be used by the syntax check.
start | Public slot to start the syntax check.
startForBrowser | Public slot to start the syntax check for the project sources browser.

### Static Methods

None

#### SyntaxCheckerDialog (Constructor)

SyntaxCheckerDialog(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### SyntaxCheckerDialog.__batchFinished

__batchFinished()

Private slot handling the completion of a batch job.

#### SyntaxCheckerDialog.__cancel

__cancel()

Private method to cancel the current check run.

#### SyntaxCheckerDialog.__clearErrors

__clearErrors(files)

Private method to clear all error and warning markers of open editors to be checked.

files (list of str)
  list of files to be checked

#### SyntaxCheckerDialog.__createErrorItem

__createErrorItem(filename, message)

Private slot to create a new error item in the result list.

filename (str)
  name of the file
message (str)
  error message

#### SyntaxCheckerDialog.__createFileStatistics

__createFileStatistics(problems)

Private method to return the file statistics entry.

problems (dict)
  dictionary with the keys 'error', 'py_warnings' and 'warnings' which hold a list of issues each

Return:
  dictionary with the file statistics

Return Type:
  dict

#### SyntaxCheckerDialog.__createHeaderItem

__createHeaderItem(filename, fileStatistics=None)

Private method to create a header item in the result list.

filename (str)
  file name of file
fileStatistics (dict (optional))
  dictionary containing statistical data of the check result (defaults to None)

#### SyntaxCheckerDialog.__createResultItem

__createResultItem(filename, line, index, error, sourcecode, isWarning=False)

Private method to create an entry in the result list.

filename (str)
  file name of file
line (int or str)
  line number of faulty source
index (int)
  index number of fault
error (str)
  error text
sourcecode (str)
  faulty line of code
isWarning (bool)
  flag indicating a warning message

#### SyntaxCheckerDialog.__defaultStatistics

__defaultStatistics()

Private method to return the default statistics entry.

Return:
  dictionary with default statistics entry

Return Type:
  dict

#### SyntaxCheckerDialog.__finish

__finish()

Private slot called when the syntax check finished or the user pressed the button.

#### SyntaxCheckerDialog.__processError

__processError(fn, msg)

Private slot to process an error indication from the service.

fn (str)
  filename of the file
msg (str)
  error message

#### SyntaxCheckerDialog.__processResult

__processResult(fn, problems)

Private slot to display the reported messages.

fn (str)
  filename of the checked file
problems (list of dict)
  list of dictionaries with the keys 'error', 'py_warnings' and 'warnings' which contain a tuple with details about the syntax error or a list of tuples with details about Python warnings and PyFlakes warnings. Each tuple contains the file name, line number, column, code string (only for syntax errors), the message and an optional list with arguments for the message.

#### SyntaxCheckerDialog.__resetStatistics

__resetStatistics(skipped)

Private method to reset the statistics data.

skipped (int)
  number of files not being checked

#### SyntaxCheckerDialog.__resort

__resort()

Private method to resort the tree.

#### SyntaxCheckerDialog.__updateStatistics

__updateStatistics(fileStatistics)

Private method to update the statistics.

fileStatistics (dict)
  dictionary containing the file statistics

#### SyntaxCheckerDialog.__updateStatisticsArea

__updateStatisticsArea()

Private method to update the statistics area of the dialog.

#### SyntaxCheckerDialog.check

check(codestring="")

Public method to start a check for one file.

The results are reported to the __processResult slot.

codestring (str)
  optional sourcestring

#### SyntaxCheckerDialog.checkBatch

checkBatch()

Public method to start a style check batch job.

The results are reported to the __processResult slot.

#### SyntaxCheckerDialog.closeEvent

closeEvent(_evt)

Protected method to handle a close event.

_evt (QCloseEvent)
  reference to the close event (unused)

#### SyntaxCheckerDialog.on_buttonBox_clicked

on_buttonBox_clicked(button)

Private slot called by a button of the button box clicked.

button (QAbstractButton)
  button that was clicked

#### SyntaxCheckerDialog.on_resultList_itemActivated

on_resultList_itemActivated(itm, col)

Private slot to handle the activation of an item.

itm (QTreeWidgetItem)
  reference to the activated item
col (int)
  column the item was activated in

#### SyntaxCheckerDialog.on_showButton_clicked

on_showButton_clicked()

Private slot to handle the "Show" button press.

#### SyntaxCheckerDialog.on_startButton_clicked

on_startButton_clicked()

Private slot to start a syntax check run.

#### SyntaxCheckerDialog.prepare

prepare(fileList, project)

Public method to prepare the dialog with a list of filenames.

fileList (list of str)
  list of filenames
project (Project)
  reference to the project object

#### SyntaxCheckerDialog.setArguments

setArguments(args)

Public method to set additional arguments to be used by the syntax check.

args (tuple of Any)
  tuple containing the additional arguments

#### SyntaxCheckerDialog.start

start(fn, codestring="", skipped=0)

Public slot to start the syntax check.

fn (str or list of str)
  file or list of files or directory to be checked
codestring (str)
  string containing the code to be checked. If this is given, fn must be a single file name.
skipped (int)
  number of files not being checked

#### SyntaxCheckerDialog.startForBrowser

startForBrowser(fn)

Public slot to start the syntax check for the project sources browser.

fn (str or list of str)
  file or list of files or directory to be checked

Up